home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / comm / bbs / HydraBBSu3.lha / HBBS_Upgrade / Installer_Script next >
Text File  |  1999-07-04  |  6KB  |  187 lines

  1. ; *** HydraBBS Upgrade script ***
  2. ;
  3. ; This script is used to upgrade from one version of HydraBBS to another
  4. ; It is a generic script, to be used for all future upgrades without further
  5. ; modification.
  6. ;
  7. ; All that has to be done is to change the following variables:
  8.  
  9. (set #requiredversion "V1.02")
  10. (set #requiredver 1)
  11. (set #requiredrev 02)
  12.  
  13. (set #newversion "V1.03")
  14. (set #newver 1)
  15. (set #newrev 03)
  16.  
  17. (set #testfile "HBBS:Control")
  18.  
  19. ; This is what the script does:
  20. ;
  21. ; * The script will check OS version
  22. ; * Then it will check to see if HydraBBS is running.
  23. ; * Then it will check the currently installed version, by checking a file
  24. ;   that was updated by the last upgrade.
  25. ; * Then it will recursivly copy, and overwrite destination files, from "Misc/",
  26. ;   "Core/" to "HBBS:"
  27. ; * If "NewConfigs/" exists and the version is *NOT* #newversion, then "NewConfigs/"
  28. ;   will be recursivly copied to "HBBS:"
  29. ; * If "HBBS:Developer/" exists then "Developer/" will be recursivly copied to "HBBS:"
  30. ; * If the file HBBS:Developer/Docs/Upgrades/Dev_Changes_XX.guide exists, it will be displayed
  31. ; * Then it displays "HBBS:Docs/Misc/Upgrades/Changes_To_XX.guide" where XX is #newversion
  32. ;
  33. ; Note: When this script is used to upgrade to HydraBBS V1.10 it will need to
  34. ; be changed because of the (set #rev) command currently returns "1" instead
  35. ; of "01" when the version is like this "V1.01".
  36. ; To compensate for this, there are leading zero's in front of the "%ld"'s
  37. ; where "##?rev"'s are used.
  38.  
  39. (if (= @user-level 0) (set @user-level 2))
  40. (if (< (/ (getversion) 65536) 37) (abort "You need 2.04 or better"))
  41.  
  42. (message "\n\nHydraBBS\n\nBy Dominic Clifton\n\nHydra^CRoSS POiNT")
  43. (message ("\n\nThis script will update a working %s installation to %s\n\nNo configuration files, data or screens will be changed\n\nIf you have been running a version of HydraBBS prior to this then study the changes carefully!" #requiredversion #newversion))
  44. (welcome)
  45.  
  46. (set #help_continue "\n\nThis is required to perform the upgrade!")
  47. (set #msg_done ("HydraBBS has been upgraded ok\n\nPlease read the document:\n\nHBBS:Docs/Misc/Upgrades/Changes_To_%s.guide\n\nReboot before re-starting HydraBBS\n(very important!)\n\nIf you have any other upgrade archives then install them NOW!"#newversion))
  48. (set #msg_HBBSRunning "\n\nCannot perform upgrade when HydraBBS is running")
  49.  
  50. (if (= (exists "ENV:HBBS_ScreenName") 1)
  51.  (
  52.   (abort #msg_HBBSRunning)
  53.  )
  54.  (
  55.  
  56.   (set #Target "HBBS:")
  57.   (set @default-dest #Target)
  58.  
  59.   (if (= (exists #Target) 2)
  60.    (
  61.     (set #vernum (getversion #testfile))
  62.  
  63.     (if (= 0 #vernum)
  64.      (
  65.       (abort "Could not find " #testfile "\nThis file is required to perform an upgrade\n\nIf you have moved this file somewhere else, then please move it back for the duration of the upgrade (Move, not copy!)")
  66.      )
  67.      (
  68.       (set #ver (/ #vernum 65536))
  69.       (set #rev (- #vernum (* #ver 65536) ) )
  70.  
  71.       (if (or (and (= #requiredver #ver) (= #requiredrev #rev)) (and (= #newver #ver) (= #newrev #rev)))
  72.        (
  73.  
  74.         (set #msg_continue ("\n\nContinue upgrading HydraBBS V%ld.0%ld\n in HBBS: to %s" #ver #rev #newversion))
  75.  
  76.         (if (= 1 (askbool (prompt #msg_Continue) (help #help_Continue) (default 1)))
  77.          (
  78.           (if (= 2 (exists "Core"))
  79.            (
  80.  
  81.             (complete 10)
  82.  
  83.             (copyfiles (source "Core/")
  84.                        (dest #Target)
  85.                        (optional "force" "nofail")
  86.                        (infos)
  87.                        (noposition)
  88.                        (all)
  89.             )
  90.  
  91.            )
  92.           )
  93.  
  94.           (if (= 2 (exists "Misc"))
  95.            (
  96.  
  97.             (complete 40)
  98.  
  99.             (copyfiles (source "Misc/")
  100.                        (dest #Target)
  101.                        (optional "force" "nofail")
  102.                        (infos)
  103.                        (noposition)
  104.                        (all)
  105.             )
  106.            )
  107.           )
  108.  
  109.           ; Only copy configs over if we're upgrading, not re-installing
  110.  
  111.           (if (and (= #ver #requiredver) (= #rev #requiredrev))
  112.            (
  113.  
  114.             (if (= 2 (exists "NewConfigs"))
  115.              (
  116.  
  117.               (complete 75)
  118.  
  119.               (copyfiles (source "NewConfigs/")
  120.                          (dest #Target)
  121.                          (optional "force" "nofail")
  122.                          (infos)
  123.                          (noposition)
  124.                          (all)
  125.               )
  126.              )
  127.             )
  128.            )
  129.           )
  130.  
  131.           (if (= 2 (exists "Developer"))
  132.            (
  133.  
  134.             (complete 80)
  135.  
  136.             (if (= 2 (exists (tackon #Target "Developer")))
  137.              (
  138.               (copyfiles (source "Developer/")
  139.                          (dest #Target)
  140.                          (optional "force" "nofail")
  141.                          (infos)
  142.                          (noposition)
  143.                          (all)
  144.               )
  145.  
  146.               (if (= 1 (exists (tackon #Target ("Developer/Docs/Upgrades/Dev_Changes_%s.guide" #newversion))))
  147.                (
  148.                 (working "Displaying Developer Documentation")
  149.                 (run "SYS:Utilities/Multiview" (tackon #Target ("Developer/Docs/Upgrades/Dev_Changes_%s.guide" #newversion)) (safe))
  150.                )
  151.               )
  152.  
  153.              )
  154.             )
  155.            )
  156.           )
  157.  
  158.           (complete 100)
  159.  
  160.           (working "Displaying Sysop Documentation")
  161.           (run "SYS:Utilities/Multiview" ("HBBS:Docs/Misc/Upgrades/Changes_To_%s.guide" #newversion) (safe))
  162.  
  163.           (message #msg_done)
  164.           (exit)
  165.  
  166.          )
  167.          (
  168.            (abort "User cancelled upgrade")
  169.          )
  170.         )
  171.        )
  172.        (
  173.         (abort
  174.                 ("You have V%ld.0%ld, %s is required!\nYou must install *ALL* prior upgrades first" #ver #rev #requiredversion)
  175.         )
  176.  
  177.        )
  178.       )
  179.      )
  180.     )
  181.    )
  182.    (
  183.     (abort "Can't find your HBBS: directory!")
  184.    )
  185.   )
  186.  )
  187. )